package org.jsbd.boss.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import jodd.util.StringUtil;

import org.jsbd.boss.dao.ISimulatorGoogleADLogDAO;
import org.jsbd.boss.domian.channel.SimulatorGoogleADLog;
import org.jsbd.boss.domian.channel.SimulatorGoogleADStatistics;
import org.jsbd.boss.util.DateUtil;
import org.springframework.stereotype.Service;

import edu.hziee.common.queue.IBatchExecutor;

@Service("simulatorGoogleADLogDao")
public class SimulatorGoogleADLogDAOImpl extends CrackLogBaseDao implements IBatchExecutor<SimulatorGoogleADLog>,ISimulatorGoogleADLogDAO{

	@Override
	public void execute(List<SimulatorGoogleADLog> records) {
		super.batchInsert("qy_simulator_googlead_log.INSERT_SIMULATOR_GOOGLEAD_LOG", records);
	}

	@Override
	public List<SimulatorGoogleADStatistics> getGoogleADStatistics(SimulatorGoogleADStatistics log) {
		Map<String,Object> conditionMap=new HashMap<String,Object>();
		if(StringUtil.isBlank(log.getCurrentDate())){	
			conditionMap.put("currentDate", DateUtil.getCurrentDateStr());
			
		}else{
			
			conditionMap.put("currentDate",log.getCurrentDate().replaceAll("-", ""));
		}
		return  super.queryForList("qy_simulator_googlead_log.SELECT_SIMULATOR_GOOGLEAD_RESULT", conditionMap);
	}

}
